﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Administration/Administration.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<IUserAccount>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Users Accounts
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
     <script type="text/javascript">

         var _searchTimeout = null;

         $(function () {
             $('#searchBox').keyup(function () {
                 if (_searchTimeout != null)
                     window.clearTimeout(_searchTimeout);
                 var timeout = this.value.length <= 2 ? (this.value.length == 0 ? 0 : 1500) : 300;
                 _searchTimeout = window.setTimeout('doSearch()', timeout);
             }).show();
         });

         function doSearch() {
             $('#submitButton').trigger('click');
         }

         function searchComplete() {

         }

        function deleteUserFailure() {
            alert('Unable to delete user');
        }

        function deleteUserSuccess() {
            alert('User successfully deleted');
            doSearch();
        }

        function enableDisableFailure() {
            alert('Unable to change user status.');
        }      
           

     </script>


    <h2>User Accounts</h2>

    <% using (Ajax.BeginForm("SearchResults", "Administration", new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "searchResults", OnComplete = "searchComplete" }, new { id = "searchForm" }))
       {  %>

        <input id="searchBox" type="text" name="query" /> 
        <input id="submitButton" type="submit" value="Search" /> 


    <% } %>

    <div id="searchResults">

    </div>
</asp:Content>
